package com.xjzd.std.concurrency;

public class ThreadMethods {

    public static void main1(String[] args) {
        System.out.println(Thread.currentThread());
    }

    public static void main2(String[] args) {
        int i = 0;
        Thread t1 = new Thread(() -> System.out.println(Thread.currentThread().getName()));
        t1.setName("模块功能-" + ++i);
        t1.start();
    }

    public static void main(String[] args) {
        // 线程优先级1-10
        Thread t1 = new Thread(() -> {
            for (int i = 0; i < 100; i++) {
                System.out.println("t1: " + i);
            }
        });
        Thread t2 = new Thread(() -> {
            for (int i = 0; i < 100; i++) {
                System.out.println("t2: " + i);
            }
        });

        t1.setPriority(10);
        t2.setPriority(1);

        t2.start();
        t1.start();
    }
}
